//
//  GYShareView.m
//  GYDemo
//
//  Created by Mrzhang on 2018/7/3.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "GYPShareView.h"
#import "Head.h"
@implementation GYPShareView
-(instancetype)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if (self)
    {
        @WeakSelf;
        for (int i=0; i<2; i++)
        {
            UIButton* btn=[UIButton buttonWithType:UIButtonTypeCustom];
            [btn setBackgroundImage:[UIImage imageNamed:i==0?@"share_wx":@"share_qq"] forState:UIControlStateNormal];
            btn.width=WFCGFloatX(71);
            btn.height=WFCGFloatX(71);
            btn.x=i==0?frame.size.width/2-btn.width-WFCGFloatX(26):frame.size.width/2+WFCGFloatX(26);
            btn.y=(frame.size.height-btn.height)/2;
            [self addSubview:btn];
        }
        
        UIButton* cancelBtn=[UIButton buttonWithType:UIButtonTypeCustom];
        [cancelBtn setBackgroundImage:[UIImage imageNamed:@"share_cancel"] forState:UIControlStateNormal];
        cancelBtn.width=WFCGFloatX(10);
        cancelBtn.height=WFCGFloatX(10);
        cancelBtn.x=ScreenWidth-WFCGFloatX(20);
        [cancelBtn setEnlargeEdge:10];
        cancelBtn.y=10;
        [cancelBtn handleControlEvent:UIControlEventTouchUpInside withBlock:^{
            selfp.handler(3);
        }];
        [self addSubview:cancelBtn];
        
    }
    return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
